// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "InputActionValue.h"
#include "GameFramework/Character.h"
#include "BaseThirdPersonCharacter.generated.h"

UCLASS(config=Game)
class ABaseThirdPersonCharacter : public ACharacter
{
	GENERATED_BODY()

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
	class USpringArmComponent* CameraBoom;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
	class UCameraComponent* FollowCamera;

public:
	ABaseThirdPersonCharacter();
protected:
	void MoveForward(float Value);
	void MoveRight(float Value);

	void MyFirstAction(const FInputActionValue& Value)
	{
		if (GEngine)
		{
			GEngine->AddOnScreenDebugMessage(-1, 20.f, FColor::Green,
			                                 FString::Printf(
				                                 TEXT("called with Input Action Value %s (magnitude %f)"),
				                                 *Value.ToString(), Value.GetMagnitude()));
		}
		// 输出调试日志，确保回调函数正常运行。
		// UE_LOG(LogTemp, Warning, TEXT(__FUNCTION__" %s called with Input Action Value %s (magnitude %f)"),
		//     TEXT(__FUNCTION__), *Value.ToString(), Value.GetMagnitude());
		// 使用 GetType() 函数来确定Value的类型；请在运算符[]中使用0到2之间的索引值来访问数据。
	}

protected:
	virtual void PawnClientRestart() override;
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

public:
	FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
	FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; }
};
